package com.atfcm.hash;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;

public class T_136_只出现一次的数字 {
    public int singleNumber(int[] nums) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int num : nums) {
            map.put(num, map.getOrDefault(num, 0) + 1);
        }
        AtomicInteger key = new AtomicInteger();
        map.forEach((k, v) ->{
            if(v == 1){
                key.set(k);
            }
        });
        return key.get();
    }
}
